﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CanDoo.Core.Data;
using CanDoo.Data;
using CanDoo.Admin.Core.Models;

namespace CanDoo.Oil.Core.Models
{
    /// <summary>
    /// 实体类——盘点单明细
    /// </summary>
    [Serializable]
    [Description("盘点单明细")]
    public class InventoryDetail :  EntityBase,ICreatedTime, IAudited
    {
        /// <summary>
        ///盘点单
        /// </summary>
        [Display(Name = "盘点单")]
        public virtual Inventory Inventory { get; set; }
        /// <summary>
        ///盘点单外键
        /// </summary>
        [Display(Name = "盘点单外键")]
        public long InventoryId { get; set; }

        /// <summary>
        ///产品
        /// </summary>
        [Display(Name = "产品")]
        public virtual Product Product { get; set; }
        /// <summary>
        ///产品外键
        /// </summary>
        [Display(Name = "产品外键")]
        public long ProductId { get; set; }

        /// <summary>
        ///原有数量
        /// </summary>
        [Display(Name = "原有数量")]
        [Required]
        public double OldNum { get; set; }

        /// <summary>
        ///盘点数量
        /// </summary>
        [Display(Name = "盘点数量")]
        [Required]
        public double InventoryNum { get; set; }

        /// <summary>
        ///盈亏数量
        /// </summary>
        [Display(Name = "盈亏数量")]
        [Required]
        public double ProfitLossNum { get; set; }

        /// <summary>
        ///损益方向1/-1
        /// </summary>
        [Display(Name = "损益方向")]
        [Required]
        public int Coefficient { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(500)]
        public string Remark { get; set; }

        
        #region Implementation of ICreatedTime

        /// <summary>
        /// 获取设置 信息创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #region Implementation of ICreatedAudited

        /// <summary>
        /// 获取或设置 创建者编号
        /// </summary>
        [Display(Name = "创建人")]
        public string CreatorUserId { get; set; }

        #endregion

        #region Implementation of IUpdateAutited

        /// <summary>
        /// 获取或设置 最后更新时间
        /// </summary>
        [Display(Name = "最后更新时间")]
        public DateTime? LastUpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 最后更新者编号
        /// </summary>
        [Display(Name = "最后更新用户")]
        public string LastUpdatorUserId { get; set; }

        #endregion
    }
}
